import request from '@/config/axios'

// 知识点 VO
export interface KnowledgeVO {
  id: string // 唯一标识
  knowName: string // 知识点名称
  chapter: number // 章节
  bookId: number // 绑定的教材
  grade: number // 年级
  bookName: string // 书籍名称
  knowUrl: string // 资源地址
}

// 知识点 API
export const KnowledgeApi = {
  // 查询知识点分页
  getKnowledgePage: async (params: any) => {
    return await request.get({ url: `/xhyy/knowledge/page`, params })
  },

  // 查询知识点详情
  getKnowledge: async (id: number) => {
    return await request.get({ url: `/xhyy/knowledge/get?id=` + id })
  },

  // 新增知识点
  createKnowledge: async (data: KnowledgeVO) => {
    return await request.post({ url: `/xhyy/knowledge/create`, data })
  },

  // 修改知识点
  updateKnowledge: async (data: KnowledgeVO) => {
    return await request.put({ url: `/xhyy/knowledge/update`, data })
  },

  // 删除知识点
  deleteKnowledge: async (id: number) => {
    return await request.delete({ url: `/xhyy/knowledge/delete?id=` + id })
  },

  // 导出知识点 Excel
  exportKnowledge: async (params) => {
    return await request.download({ url: `/xhyy/knowledge/export-excel`, params })
  },
}